package com.zenithmind.chat.service;

import com.zenithmind.chat.pojo.dto.AiChatMessageDTO;
import org.springframework.web.servlet.mvc.method.annotation.SseEmitter;

/**
 * AI对话流式服务接口
 * 遵循单一职责原则，专门负责流式响应处理
 */
public interface AiChatStreamService {
    
    /**
     * 发送流式消息
     * 
     * @param messageDTO 消息DTO
     * @param userId 用户ID
     * @return SseEmitter
     */
    SseEmitter sendMessageStream(AiChatMessageDTO messageDTO, String userId);
    
    /**
     * 创建SSE连接
     * 
     * @return SseEmitter
     */
    SseEmitter createSseEmitter();
    
    /**
     * 处理SSE连接超时
     * 
     * @param emitter SseEmitter
     */
    void handleSseTimeout(SseEmitter emitter);
    
    /**
     * 处理SSE连接错误
     * 
     * @param emitter SseEmitter
     * @param throwable 异常
     */
    void handleSseError(SseEmitter emitter, Throwable throwable);
    
    /**
     * 完成SSE连接
     * 
     * @param emitter SseEmitter
     */
    void completeSse(SseEmitter emitter);
}
